package com.easydata.agent.entity.web;

import lombok.Data;

@Data
public class Response {

    private int code = 0;
    private String msg = "";
    private Object data = null;


    public static Response ok(Object data){
        var ret = new Response();
        ret.setData(data);
        return ret;
    }

    public static Response error(int code,String msg ){
        var ret = new Response();
        ret.setCode(code);
        ret.setMsg(msg);
        return ret;
    }

    public static Response needAuthority(String msg){
        var ret = new Response();
        ret.setCode(-1);
        ret.setMsg("require the authority");
        return ret;
    }
}
